package com.sailorj.mapper;

import com.sailorj.entity.SysUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SysUserMapper {

    /**
     * 查询用户是否存在，若是存在则提示已存在
     * @param name
     * @return
     */
    @Select(value = "select u.user_name,u.pass_word from sys_user u where u.user_name=#{userName}")
    SysUser findUserNameByName(String name);

    /**
     * 用户登录
     * @param user
     * @return
     */
    @Select("select * from sys_user u where u.user_name = #{userName} and u.pass_word = #{passWord}")
    SysUser login(SysUser user);

    int deleteByPrimaryKey(Integer id);

    int insert(SysUser record);

    int insertSelective(SysUser record);

    SysUser selectByPrimaryKey(Integer id);


    @Select("select * from sys_user where is_delete = 0 limit #{page},#{size}")
    List<SysUser> selectUserList(@Param("page") Integer page, @Param("size")Integer size);

    int updateByPrimaryKeySelective(SysUser record);

    int updateByPrimaryKey(SysUser record);

    @Select("select count(*) from sys_user")
    Long getTotal();
}